package collection;
/**
 * 增强型for循环，也叫新循环 
 * */
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {

        Collection c = new ArrayList();
        Collection<String> cc = new ArrayList<>();






































/*

        String [] array ={ "one", "two","three","four","five"};
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
        Collection c = new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        Iterator it = c.iterator();
        while (it.hasNext()){
            String str = (String) it.next();
            System.out.println(str);
        }

//          元素类型  变量名 ：    数组或者集合名称
        for ( String  str      : array          ) {
            System.out.println(str);
        }
        for (Object obj: c
             ) {
            String str = (String) obj;
            System.out.println(str);
            //c.add("six"); //  底层依然是迭代器，不支持集合的增删
        }
        */

    }
}
